//
//  xuanzeViewController.m
//  hainingOASystem
//
//  Created by michael on 2017/12/14.
//  Copyright © 2017年 czd. All rights reserved.
//

#import "xuanzeViewController.h"
#import "qiyeViewController.h"
#import "OALoginViewController.h"
#import "gerenViewController.h"
#import "XYChooseTypeAlertView.h"
@interface xuanzeViewController ()<XYChooseTypeAlertViewDelegate>
@property (nonatomic,strong)XYChooseTypeAlertView *alertV;
@end

@implementation xuanzeViewController
- (void)viewWillAppear:(BOOL)animated {
NSLog(@"1111");
     NSArray *arr = @[@"个人",@"企业",@"返回"];

_alertV = [[XYChooseTypeAlertView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) withTitleArray:arr];
    //2.设置代理
    _alertV.type = @"no";
    _alertV.delegate = self;
    //3.显示
    [_alertV showChooseTypeView];}
- (void)viewDidLoad {
    [super viewDidLoad];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:

[UIColor whiteColor],NSForegroundColorAttributeName, nil];
 
[self.navigationController.navigationBar setTitleTextAttributes:attributes];
 self.navigationController.navigationBar.barTintColor = COLORRGB(0x3F51B5);self.title = @"注册";
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    
UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:@"返回"style:UIBarButtonItemStylePlain target:self action:@selector(buttonClick)];
// self.navigationItem.leftBarButtonItem = item1;
      UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(keybordDown)];
//    [self.view addGestureRecognizer:tap];
    //1.初始化
    // Do any additional setup after loading the view.
}

- (void)buttonClick{
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

        OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
    self.view.window.rootViewController = navVC;
        loginVC.navigationController.navigationBar.hidden = YES;


}
- (void)keybordDown {
     NSArray *arr = @[@"个人",@"企业"];
XYChooseTypeAlertView *alertV = [[XYChooseTypeAlertView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) withTitleArray:arr];
alertV.type = @"no";
    //2.设置代理
    alertV.delegate = self;
    //3.显示
    [alertV showChooseTypeView];
}
- (void)chooseTypeAlertView:(XYChooseTypeAlertView *)alertView didSelectedIndex:(NSInteger)index
{ if(index ==0){
    
    gerenViewController *vc = [[gerenViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];


    }
if(index ==1){
    
    qiyeViewController *vc = [[qiyeViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];


    }
    if(index ==2){
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

        OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
    self.view.window.rootViewController = navVC;
        loginVC.navigationController.navigationBar.hidden = YES;


}


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
//    [_alertV removeFromSuperview];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
